package design.mode.memento.item1;

import java.util.Stack;

/**
 * /**
 *
 * @author ZhongMingde on 2021/11/20
 */

public class SnapShotHolder {

  private Stack<InputText> snapshots = new Stack();

  public InputText popSnapshot(){
    return snapshots.pop();
  }

  public void pushSnapshot(InputText inputText){
    InputText deepClonedInputText = new InputText();
    deepClonedInputText.setText(inputText.getText());
    snapshots.push(deepClonedInputText);
  }
}
